﻿using System;
using System.Data;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;

namespace AnyOffice.general.hrms.manage
{
    public partial class hrms : ModulePage
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            string userId = (Request.QueryString["user_id"] != null) ? Request.QueryString["user_id"].ToString() : string.Empty;
            int num = (Request.QueryString["dept_id"] != null) ? int.Parse(Request.QueryString["dept_id"].ToString()) : 0;
            if (userId != string.Empty)
            {
                int num2 = 0;
                DataTable table = new HrmsDao().SelectByUserId(base.Conn, userId);
                if (table.Rows.Count > 0)
                {
                    num2 = Convert.ToInt32(table.Rows[0]["HrmsId"].ToString());
                }
                base.CloseConn();
                if (num2 != 0)
                {
                    Response.Redirect("edit.aspx?hrms_id=" + num2.ToString() + "&dept_id=" + num.ToString());
                }
                else
                {
                    Response.Redirect("new.aspx?user_id=" + userId + "&dept_id=" + num.ToString());
                }
            }
        } 

    }
}
